package model

import (
	"gorm.io/gorm"
)

type ProductTag struct {
	gorm.Model

	TagId     uint `json:"parentId" gorm:"type:bigint(20) unsigned;comment:标签ID"`
	ProductId uint `json:"parentId" gorm:"type:bigint(20) unsigned;comment:产品ID"`
}

func (t *ProductTag) TableName() string {
	return "c_product_tag"
}

func (r *ProductTag) Create(productTag *ProductTag) error {
	return GetDB().Create(productTag).Error
}

func (r *ProductTag) DelAll(productId uint) error {
	return GetDB().Delete(&ProductTag{}, "product_id = ?", productId).Error
}
